package com.cxyzy.souldemo

import android.Manifest
import android.os.Bundle
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import com.qw.soul.permission.SoulPermission
import com.qw.soul.permission.bean.Permission
import com.qw.soul.permission.callbcak.CheckRequestPermissionListener

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        SoulPermission.getInstance().checkAndRequestPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE,
                object : CheckRequestPermissionListener {
                    override fun onPermissionOk(permission: Permission) {
                        Toast.makeText(this@MainActivity, "已授权", Toast.LENGTH_SHORT).show()
                    }

                    override fun onPermissionDenied(permission: Permission) {
                        Toast.makeText(this@MainActivity, "未授权", Toast.LENGTH_SHORT).show()
                    }
                })
    }
}